<SCRIPT LANGUAGE="JavaScript">
<!--


<script type="text/javascript" charset="utf-8">

function media_player (src) {
    if (this.player == null) {
    	// Create Media object from src
    	this.player = new Media(src, onSuccess, onError);
    	this.mediaTimer = null;
    }
    
    // Play audio
    this.playAudio = function() {
    	this.player.play();

    	// Update my_media position every second
    	if (this.mediaTimer == null) {
    		this.mediaTimer = setInterval(function() {
        		// get my_media position
        		this.player.getCurrentPosition(
        			// success callback
        			function(position) {
       					if (position > -1) {
             				setAudioPosition((position) + " sec");
            			}
        			},
        			// error callback
            		function(e) {
            			console.log("Error getting pos=" + e);
            			setAudioPosition("Error: " + e);
            		}
        		);
			}, 1000);
       	}
	}

	// Pause audio
	this.pauseAudio = function() {
 		if (this.player) {
     		this.player.pause();
    	}
	}

	// Stop audio
	this.stopAudio = function() {
   		if (this.player) {
     		this.player.stop();
    	}
    	clearInterval(this.mediaTimer);
    	this.mediaTimer = null;
	}

	// onSuccess Callback
	this.onSuccess = function() {
		console.log("playAudio():Audio Success");
	}

	// onError Callback
	this.onError = function(error) {
   		alert('code: '    + error.code    + '\n' + 'message: ' + error.message + '\n');
	}
}
</script>
 -->
</SCRIPT>